//
//  AXMySrdzWdktYgmCell.m
//  AnXin100
//
//  Created by 天质弘耕 on 2018/11/7.
//  Copyright © 2018 tzhg. All rights reserved.
//

#import "AXMySrdzWdktYgmCell.h"
#import "UIView+SDAutoLayout.h"
#import "ZXCategories.h"
#import "UITableView+SDAutoTableViewCellHeight.h"


@implementation AXMySrdzWdktYgmCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self creatView];
        [self setlayout];
    }
    return self;
}


- (void)creatView {
    /** 产品图片 */
    self.productImageView = [[UIImageView alloc]init];
    self.productImageView.image = [UIImage imageNamed:@"yc.jpeg"];
    self.productImageView.contentMode =UIViewContentModeScaleAspectFill;
    self.productImageView.clipsToBounds=YES;//
    [self.contentView addSubview:self.productImageView];
    /** 产品名字 */
    self.nameLabel = [[UILabel alloc]init];
    self.nameLabel.text = @"烟草花叶病的有效防治";
    self.nameLabel.textColor = COLOR_Gray;
    self.nameLabel.numberOfLines = 2;
    self.nameLabel.font = FONT_FOURTEEN;;
    [self.contentView addSubview:self.nameLabel];
    /** 产品价格 */
    self.priceLabel = [[UILabel alloc]init];
    self.priceLabel.text = @"￥120.00";
    self.priceLabel.font = FONT_FOURTEEN;
    self.priceLabel.textColor = COLOR_ORG;
    [self.contentView addSubview:self.priceLabel];
    
    self.teacherLabel = [[UILabel alloc]init];
    self.teacherLabel.text = @"夏老师  高级农艺师";
    self.teacherLabel.textColor = COLOR_Gray;
    self.teacherLabel.font = FONT_FOURTEEN;;
    [self.contentView addSubview:self.teacherLabel];
    
    /** 购物按钮 */
    self.shopButton = [[UIButton alloc]init];
    self.shopButton.titleLabel.font = FONT_FOURTEEN;
    self.shopButton.cornerRadius = 5;
    self.shopButton.backgroundColor = COLOR_ORG;
    [self.shopButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.shopButton setTitle:@"距开课29小时" forState:UIControlStateNormal];
    [self.contentView addSubview:self.shopButton];
    
    
    
    
}

- (void)setlayout {
    self.productImageView.sd_layout
    .leftSpaceToView(self.contentView, 10)
    .centerYEqualToView(self.contentView)
    .widthIs(100)
    .heightIs(100);
    
    self.nameLabel.sd_layout
    .leftSpaceToView(self.productImageView, 10)
    .topSpaceToView(self.contentView, 10)
    .rightSpaceToView(self.contentView, 10)
    .heightIs(60);
    
    self.teacherLabel.sd_layout
    .leftSpaceToView(self.productImageView, 10)
    .topSpaceToView(self.nameLabel, 10)
    .widthIs(SCREEN_WIDTH-130)
    .heightIs(30);
    
    self.priceLabel.sd_layout
    .leftSpaceToView(self.productImageView, 10)
    .topSpaceToView(self.teacherLabel, 10)
    .widthIs(SCREEN_WIDTH-130)
    .heightIs(30);
    
    self.shopButton.sd_layout
    .rightSpaceToView(self.contentView, 10)
    .topSpaceToView(self.teacherLabel, 10)
    .widthIs(120)
    .heightIs(30);
    
  
    
    /** cell 自适应第一步 */
    [self setupAutoHeightWithBottomView:self.shopButton bottomMargin:10];
    
}

@end
